execute as @a run function advm:skills/iron_drill
execute as @a run function advm:skills/iron_drill_detect
execute as @a run function advm:skills/battery_swapper
execute as @a run function advm:skills/night_vision_goggle

execute as @a run function advm:is_hyperloaded

function advm:machines/electric_button_keep
function advm:machines/entity_bouncer_keep
function advm:machines/entity_stopper_hopper_keep
function advm:machines/item_deleter_keep
function advm:machines/item_keeper_keep
function advm:machines/battery_box_keep
function advm:machines/wire_keep
function advm:machines/battery_recharger_keep
function advm:machines/wheat_minion_keep
function advm:machines/lightning_creator_keep
function advm:machines/electric_craft_bench_keep

execute as @e[type=item_frame,nbt={Tags:["wire"]}] at @s run function advm:machines/wire_find_next
execute as @e[type=item_frame,nbt={Tags:["wire_spread"]}] at @s run function advm:machines/wire_spread_find_nexts

execute as @a[nbt={Inventory:[{Slot:-106b,tag:{id:"advm:battery_unlimited"}}]}] as @a[nbt=!{Inventory:[{tag:{power:2147483647}}]}] run loot replace entity @s weapon.offhand loot advm:op_battery

execute as @a[nbt={Inventory:[{Slot:-106b,tag:{battery:1b}}]}] run title @s actionbar [{"score":{"name": "@s","objective": "advm_power"}},{"text":"/","italic": false},{"score":{"name": "@s","objective": "advm_power_max"}},{"text":" ⚡","italic": false}]

execute if score $const advm_tick matches 0 run scoreboard players set #const advm_tick 1
execute unless score $const advm_tick matches 0 run scoreboard players set #const advm_tick 0

execute as @e[type=item,nbt={Item:{id:"minecraft:wooden_shovel",tag:{id:"advm:spanner"}}}] run function #advm:spanner_build

